export default {
    data_parse_Air(AirData, num) {
        // console.log(AirData);
        if (num == 1) {
            let a = AirData[0]
            let b = AirData[1]
            if (b < 10) b = 0 + "" + b;
            let ab = a.toString(16) + '' + b.toString(16)
            let data1 = parseInt(ab, 16) / 10 + "°C";
            return data1;
        } else if (num == 2) {
            let a = AirData[2]
            let b = AirData[3]
            if (b < 10) b = 0 + "" + b;
            let ab = a.toString(16) + '' + b.toString(16)
            let data2 = parseInt(ab, 16) / 10 + "%"
            return data2
        } else if (num == 3) {
            let a = AirData[4]
            let b = AirData[5]
            if (b < 10) b = 0 + "" + b;
            // console.log(a,)
            let ab = a.toString(16) + '' + b.toString(16)
            let data3 = parseInt(ab, 16) / 10 + "hPa"
            return data3
        } else if (num == 4) {
            let a = AirData[6]
            let b = AirData[7]
            if (b < 10) b = 0 + "" + b;
            let ab = a.toString(16) + '' + b.toString(16)
            let data4 = parseInt(ab, 16) * 10 + "Lux"
            return data4
        } else if (num == 5) {
            let a = AirData[8]
            let b = AirData[9]
            if (b < 10) b = 0 + "" + b;
            let ab = a.toString(16) + '' + b.toString(16)
            let data5 = parseInt(ab, 16) + "ppm"
            return data5
        }
    },
    data_getWind(Wind, num) {
        if (num == 1) {
            let a = Wind[0];
            let b = Wind[1];
            if (b < 10) b = 0 + "" + b;
            let ab = a.toString(16) + "" + b.toString(16);
            let data1 = parseInt(ab, 16) / 100 + "m/s";
            return data1;
        }
        if (num == 2) {
            let a = Wind[2];
            let b = Wind[3];
            if (b < 10) b = 0 + "" + b;
            let ab = a.toString(16) + "" + b.toString(16);
            let data1 = parseInt(ab, 16) * 10;
            let data2 = parseInt(data1 / 90);
            let data3 = data1 % 90;
            if (data3 == 0) {
                if (data2 == 0 || data2 == 4) {
                    return "正北方向";
                } else if (data2 == 1) {
                    return "正东方向";
                } else if (data2 == 2) {
                    return "正南方向";
                } else if (data2 == 3) {
                    return "正西方向";
                }
            }
            if (data2 == 1) {
                return "北偏东" + data3 + "°";
            } else if (data2 == 2) {
                return "东偏南" + data3 + "°";
            } else if (data2 == 3) {
                return "南偏西" + data3 + "°";
            } else {
                return "西偏北" + data3 + "°";
            }
        }

        // data_parse_soli(Soil3, num) {
        //     if (num == 1) {
        //         let a = Soil3[0]
        //         let b = Soil3[1]
        //         let ab = a.toString(16) + '' + b.toString(16)
        //         let data1 =  parseInt(ab, 16) / 10 + "%";
        //         return data1
        //     } else if (num == 2) {
        //         let a = Soil3[2]
        //         let b = Soil3[3]
        //         let ab = a.toString(16) + '' + b.toString(16)
        //         let data2 = parseInt(ab, 16) / 10 + "°C";
        //         return data2
        //     } else if (num == 3) {
        //         let a = Soil3[4]
        //         let b = Soil3[5]
        //         let ab = a.toString(16) + '' + b.toString(16)
        //         let data3 =  parseInt(ab, 16) + "us/cm";
        //         return data3
        //     }
        //
    }
}
